/*
**hb.js要放在页面最后
 */
window.$HB={
    HB_BI_PATH:'http://172.25.43.52/index.html',//移动探针 电信：http://192.168.5.12:16018/index.html 联通: http://10.7.198.104:15000/index.html
    timerChannelSwitch:null,//跳转频道
    oQuietParas:null,
    SP_ID:'',
    APP_ID : $Cookie.get('appId'),
    uiName : {
        "index":"首页",
        "category":"分类",
        "history":"历史",
        "search":"搜索",
        "collection":"收藏",
        "subjects":"专题列表",
        "subject":"专题",
        "classSchedule":"课程",
        "customize":"课程定制",
        "detail":"详情",
        "player" : "播放器",
        "subscribe":"订购"
    },
    isTest:0,//测试位1,正式为0,用来处理数字键是跳直播还是打日志使用
    iBgCId:1227,//通用的背景图分类
    channelNum:'',//记录频道号
    iRangeTime:'0',//书签时间点
    strAuthContentId:'a8280dad6eda4e95a81e980888df52dc',//鉴权的虚拟code(移动新东方）
    strProductId:"00910000000010010000000000000075",
    iTestAuth:0,//测试鉴权结果成功todo:
    aProductList:[],
    iProbability:0,//默认是0
    iProductPrice:0,
    isOrderMode:0,
    strPlatform : "yd",
    oOptionalOrderInfo : $Cookie.get('optional_possible_order'),
    requestHbProbe:function(action,describe){//河北探针
        // if(!$HB.strStbIP){return}
        var biPath=$HB.HB_BI_PATH+'?'+$HB.strPlatform+'|'+$HB.strFactIp+'|'+$HB.strUserId+'|sp|新东方|';//前面那截固定
        switch(action){
            case "browse":
                //页面名称 5,开始时间
                strArgs=action+'|||'+$HB.uiName[$Page.CURRENT_UI]+'|'+(new Date().getTime())+'||||';
                break;
            case "click"://有第二个参数时,填推荐位id或者推荐位名称
                //页面名称;页面点击位置,推荐位名称和节目名称,本地写死的跳转;开始时间
                strArgs=action+'|'+$HB.uiName[$Page.CURRENT_UI]+'||'+describe+'|'+(new Date().getTime())+'||||';
                break;
            case "order"://第二参,产品名称
                //产品ID,页面名称,开始时间,产生订购导流的mediacode,产品名称
                if (describe.code){
                    strArgs=action+'|'+describe.id+'||'+$HB.uiName[$Page.CURRENT_UI]+'|'+(new Date().getTime())+'||'+describe.code+'||'+describe.name;
                }else {
                    strArgs=action+'|'+describe.id+'||'+$HB.uiName[$Page.CURRENT_UI]+'|'+(new Date().getTime())+'||'+$HB.strAuthContentId+'||'+describe.name;
                }
                break;
            case "vod":
                //二级分类名称,视频名称,开始时间,结束时间,影片的mediacode
                strArgs=action+'|'+$HB.uiName[$Page.CURRENT_UI]+'||'+describe.vodName+'|'+describe.iHeadTime+'|'+describe.iEndTime+'|'+describe.mediaCode+'||';
        }
        biPath+=strArgs;
        $Log.info(biPath);
        $Network.ajax('GET',biPath,null,null,function(responseText){
            $Log.info("hbProbe Business::");
        },function(responseText){
            $Log.info("hbProbe Communication::");
        },{timeout:800});
    },
    createChannelNumEle:function(){//创建频道号的dom元素
        var id="channelNum22";
        if(!$Dom.getById(id)){
            var dom=$Dom.create('div');
            dom.id=id;
            document.body.appendChild(dom);
        }
        $Dom.getById(id).setAttribute('class','smallResolution');
        $Dom.getById(id).style.zIndex='1000';
    },
    initHbEPG:function(){//初始化相关河北的全局变量,或者根据returnUrl来判断
        try{
            $KeyHandler.aTestKeyCode =['KEY_UP', 'KEY_VOL_UP', 'KEY_RIGHT', 'KEY_DOWN', 'KEY_VOL_DOWN'];//河北现网秘籍专用
            $HB.strUserId = $Cookie.get('platformAccount') || (($Cookie.get('userId')=='null')?window.Authentication&&Authentication.CTCGetConfig("UserID"):$Cookie.get('userId'));//用户Id
            //根据returnUrl这个参数处理
            var strReferUrl = decodeURIComponent($URL.getQueryStringByName("referURL")) || decodeURIComponent($Cookie.getOneAll("referURL"));
            var indexUrl=strReferUrl;
            if(indexUrl && (-1!=indexUrl.indexOf('portal.jsp')||-1!=indexUrl.indexOf('Category.jsp'))){//根据返回地址
                if (0 == strReferUrl.indexOf('[')) {//[开头，是数组
                    var arrSplitRefer = strReferUrl.substr(0, strReferUrl.lastIndexOf(']') + 1);
                    arrSplitRefer = JSON.parse(arrSplitRefer);
                    indexUrl = arrSplitRefer[0];
                }
                var iIndex1 = 0;
                var iIndex2 = 100000;
                if(-1!=indexUrl.indexOf('Category.jsp')){
                    $HB.strPlatform = "hw2";
                    iIndex1 = indexUrl.indexOf('Category.jsp');
                }else{
                    iIndex1 = indexUrl.indexOf('portal.jsp');
                }
                if(-1!=indexUrl.indexOf('backURL')){
                    iIndex2 = indexUrl.indexOf('backURL');
                }
                if(-1!=indexUrl.indexOf('BackUrl')){
                    iIndex2 = indexUrl.indexOf('BackUrl');
                }
                if(-1!=indexUrl.indexOf('backUrl')){
                    iIndex2 = indexUrl.indexOf('backUrl');
                }
                if(iIndex2 < iIndex1){
                    indexUrl = decodeURIComponent(($URL.getQueryStringByName("backURL",indexUrl)||$URL.getQueryStringByName("BackUrl",indexUrl)||$URL.getQueryStringByName("backUrl",indexUrl)));
                }
                $Log.warn(indexUrl);
                $HB.EPGDomain=indexUrl.split('?')[0];
            }else{//根据盒子,不需要截取http://192.168.0.12:33200/EPG/jsp/gdgaoqing/en/Category.jsp
                $HB.EPGDomain=window.Authentication&&Authentication.CTCGetConfig('EPGDomain');//华为,epg首页地址,
            }
            var strPartner = $Cookie.getOneAll('partner') || $Cookie.get('partner');
            if(strPartner&&(strPartner.toLowerCase()=="huawei3" || strPartner.toLowerCase()=="hw3")){
                $HB.strPlatform = "hw3";
            }
            if(strPartner&&(strPartner.toLowerCase()=="huawei2" || strPartner.toLowerCase()=="hw2")){
                $HB.strPlatform = "hw2";
            }
	    //针对河北活动特殊处理
            $Config.PAGES.activity = "../../../apps/events/active_luckydraw/index.html?partner="+$HB.strPlatform;//仝飞同事做的活动页
            $HB.strStbUserToken=Authentication.CTCGetConfig('UserToken');//用户动态令牌
            $HB.strAreaId=$Cookie.get('areaID');//用户地区Id
            $HB.host = $HB.EPGDomain.substring(0,($HB.EPGDomain.lastIndexOf('/')));
            var strs = $HB.host.split('/');
            $HB.strIp=strs[1]+''+strs[2];//192.168.0.12:33200
            if($HB.strIp){
                $HB.strStbIP=$HB.strIp.match(/(\d.)+/)[0];//ip地址不带端口
            }
            $HB.strFactIp=Authentication.CTCGetConfig('IP');//机顶盒ip
            if($HB.strFactIp){
                var aMatch = $HB.strFactIp.match(/(\d.)+/);
                if(aMatch){
                    $HB.strFactIp = [0];
                }
            }else{
                $HB.strFactIp = $HB.strIp;
            }
            $Constant.HAS_CREDENTIALS_PATH.push($HB.host);
        }catch(err){
            $Log.error('initHb err::'+err);
        }
    },
    Auth:function(returnUrl,mediaCode,callBack){//鉴权
        if (!$HB.host){
            $Cookie.set("isAuthenticated",0);
            callBack&&callBack(0);
            return;
        }
        var  backUrl;
        if (!returnUrl){
            returnUrl = window.location.href+"&backStatus=1&businessCode=success";
            backUrl = window.location.href+"&backStatus=1&businessCode=failure";
        }
        var strAuthUrl=$HB.host+'/datajsp/au_PlayFilmData.jsp';
        if (mediaCode){//歌曲鉴权
            $Log.info("歌曲鉴权11="+mediaCode);
            var oAuthParas={
                "mediaCode":mediaCode,
                // "productLevel":1,
                "source" : "xdf",//针对新东方扶贫页面需求，需要在参数里面增加参数source,为扶贫区提供免费视频
                "returnUrl":escape(returnUrl),
                "backUrl":escape(backUrl)
            };
            $Probe.context.contentId=oAuthParas.mediaCode;
            $Network.ajax('GET',strAuthUrl,null,oAuthParas,function(responseText){
                try {
                    var oJsonResult = JSON.parse(responseText);
                    var isSub=oJsonResult.forwardJson.isSub;
                    $HB.strOrderUrl=oJsonResult.forwardJson.forwardUrl;
                    var isAuthStatus=0;//鉴权结果
                    var strProductId = "";
                    if(isSub==0){
                        isAuthStatus=1;//鉴权成功
                        if(typeof(oJsonResult.productObject.productList[0])!='undefined'||oJsonResult.productObject.productList==null){//免费或者其他情况,没有时
                            strProductId = oJsonResult.productObject.productList[0].productId;
                            $Log.warn(strProductId);
                        }
                    }else{
                        isAuthStatus=0;//1/5/98鉴权失败或者2鉴权错误
                    }
                    $Probe.authResult=isAuthStatus;//鉴权结果
                    var oParam={
                        "productId":strProductId,
                        "result":isAuthStatus,//鉴权结果 0失败,1成功
                        "mediaId":-1,
                        "mediaCode":mediaCode
                    }
                    $Probe.Auth(oParam);
                    callBack&&callBack(isAuthStatus,strProductId);
                } catch (err) {
                    $Log.error("Business Exception: auth Error..." + "</br>err:" + err);
                    callBack&&callBack(0);
                }

            },function(responseText){
                $Probe.authResult=0;
                $Probe.context.contentId+=$Probe.context.contentId+'_failure';
                $Probe.Auth({
                    "productId":"",
                    "result":0,//鉴权结果 0失败,1成功
                    "mediaId":-1,
                    "mediaCode":mediaCode
                });
                //错误，直接跳转：根目录下 infoDisplay.html?errod_code=1001&returnUrl=返回时的地址
                if($HB.host){//浏览器这边兼容处理下
                    var strErrorUrl=$HB.host+'/infoDisplay.html?errod_code=1001';
                    $HB.jumpCp(strErrorUrl);
                }
                $Log.error('Coummunication: '+strInfo+' Error...'+responseText+'!!');
                callBack&&callBack(0);
            });
        }else {
            //默认mediacode
            var authCheck = 0;
            var oAuthParas={
                "mediaCode":$HB.strAuthContentId,
                // "productLevel":1,
                "source" : "xdf",//针对新东方扶贫页面需求，需要在参数里面增加参数source,为扶贫区提供免费视频
                "returnUrl":escape(returnUrl),
                "backUrl":escape(backUrl)
            };

            $Network.ajax('GET',strAuthUrl,null,oAuthParas,function(responseText,mediaCode){
                try {
                    var oJsonResult = JSON.parse(responseText);
                    var isSub=oJsonResult.forwardJson.isSub;
                    $HB.strOrderUrl=oJsonResult.forwardJson.forwardUrl;
                    var isAuthStatus=0;//鉴权结果
                    var strProductId = "";
                    if(isSub==0){
                        isAuthStatus=1;//鉴权成功
                        if (oJsonResult.productObject.productList.length == 0){
                            strProductId = $HB.strProductId;
                        }else {
                            strProductId = oJsonResult.productObject.productList[0].productId;
                        }
                    }else{
                        isAuthStatus=0;//1/5/98鉴权失败或者2鉴权错误
                        if(isSub==1||isSub==5||isSub==98){
                            //电信方把返回地址自己拼在forwardUrl里面了
                            
                            var productList = oJsonResult.productObject.productList;
                            $HB.aProductList = $HB.aProductList.concat(productList);
                        }
                        $Log.warn('auth errorMsg::'+oJsonResult.error_msg);
                    }
                    if(parseInt($Cookie.get("isAuthenticated")) != 1 && $Probe.orderResult != -2){
                        if(isAuthStatus == 1){
                            $Probe.orderResult=0;
                            $Probe.Subscribed({
                                "productId":$Probe.productId,
                                "unitPrice":$Probe.productPrice,
                                "mediaId":$Probe.mediaId,
                                "mediaCode":$Probe.mediaCode,
                                'orderMode':$Probe.orderMode,//jm1,正常0,
                                "result":$Probe.orderResult,//订购结果 -1失败,0成功
                                'transactionId':$Probe.transactionId
                            });
                        }else if($Probe.orderMode == 1){
                            $Probe.orderResult = -1;//失败
                            $Probe.Subscribed({
                                "productId":$Probe.productId,
                                "unitPrice":$Probe.productPrice,
                                "mediaId":$Probe.mediaId,
                                "mediaCode":$Probe.mediaCode,
                                'orderMode':$Probe.orderMode,//jm1,正常0,
                                "result":$Probe.orderResult,//订购结果 -1失败,0成功
                                'transactionId':$Probe.transactionId
                            });
                        }
                    }
                    $Cookie.set("isAuthenticated",isAuthStatus);
                    $Probe.context.contentId=mediaCode;
                    var oParam={
                        "productId":"",
                        "result":isAuthStatus,//鉴权结果 0失败,1成功
                        "mediaId":-1,
                        "mediaCode":mediaCode
                    }
                    $Probe.Auth(oParam);
                    //鉴权成功后传给春哥
                    $HB.authProbe(isAuthStatus,strProductId,$HB.APP_ID,function(){
                        callBack&&callBack(isAuthStatus,strProductId);
                    });
                   

                } catch (err) {
                    callBack&&callBack(isAuthStatus);
                    $Log.error("Business Exception: auth Error.1.." + responseText + "</br>err:" + err);
                }
                // authCheck++;
                // if (authCheck == 2){
                //     callBack&&callBack();
                // }
            },function(responseText){
                //错误，直接跳转：根目录下 infoDisplay.html?errod_code=1001&returnUrl=返回时的地址
                if($HB.host){//浏览器这边兼容处理下
                    var strErrorUrl=$HB.host+'/infoDisplay.html?errod_code=1001';
                    $HB.jumpCp(strErrorUrl);
                }
                $Log.error('Coummunication: '+strInfo+' Error...'+responseText+'!!');
                authCheck++;
                //if (authCheck == 2){
                    callBack&&callBack(0);
                //}
            },oAuthParas.mediaCode);
        }
    },
    /**
     * 在某些页面返回时可配置是否做jm订购
     */
    getOptionalOrderInfo : function(fnCb){
        $Network.request({
            data : {
                "start":0,
                "limit":100,
                "dictName":"optional_possible_order_xdf"
            },
            desc : "optional_possible_order",
            url : $Circumstance.TOPDRAW_API_SERVER + 'Dict/ListDetail',
            success : function(oJSONResult){
                $Cookie.del('optional_possible_order');
                $HB.oOptionalOrderInfo = {};
                for(var i = 0; i < oJSONResult.resultSet.length; i++){
                    $HB.oOptionalOrderInfo[oJSONResult.resultSet[i].label] = 1;
                }
                $Cookie.set('optional_possible_order',JSON.stringify($HB.oOptionalOrderInfo))
                fnCb&&fnCb();
            },
            failure : fnCb
        });
    },
    authProbe:function(isAuthStatus,strProductId,strProduction,fnCb) {
        var oSubscribePara={
            "result":isAuthStatus?0:-1,
            "productId":strProductId,
            "businessArea":strProduction
        };
        $API.auth({
            data : oSubscribePara,
            success : function(oJSONResult){
                fnCb&&fnCb();
            },
            failure : function(oJSONResult){
                fnCb&&fnCb();
            }
        });
    },
    orderProductHB:function(productId,productType,vorderFrom,mediaCode){//去订购 //productType非必须
        // jumpCp($HB.strOrderUrl);//根据鉴权失败时,反馈的订购跳转地址
        // strDestUrl+=((-1==$HB.strOrderUrl.indexOf('?'))?'?':'&')+'returnUrl=';//+encodeURIComponent(strReturnUrl);//跳直播后都返回到随动页去了
        // $Log.warn($HB.EPGDomain+"?spVodPlayUrl="+encodeURIComponent($HB.strOrderUrl));
        // window.parent.location.href=$HB.EPGDomain+"?spVodPlayUrl="+encodeURIComponent($HB.strOrderUrl);

        //测试数据
        // productId = "19010731174849000007";//连续包月
        // productType = 0;
        // vorderFrom = "yinyuedidai";
        var orderBackURL = window.location.href;
        orderBackURL=$URL.cleanEPGURLExcessParams(orderBackURL,true);
        // if(-1==orderBackURL.split('?')[0].indexOf('/game/')){//排除首页,专注订购页
        //     orderBackURL=$URL.cleanEPGURLExcessParams(orderBackURL,false);
        //     orderBackURL+=(-1!=orderBackURL.indexOf('?')?'&':'?')+'referURL=';//先把referURL去掉,以防地址过长
        // }
        // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'businessCode');
        // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'productId');
        // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'transactionId');
        // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'productPrice');
        // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'UserID');
        orderBackURL=$URL.removeParameterFromURL(['businessCode','productId','transactionId','productPrice','UserID'],orderBackURL);
        orderBackURL += "&transactionId="+$Probe.transactionId+"&productId="+$Probe.productId+"&productPrice="+$Probe.productPrice+'&UserID='+$HB.strUserId;
        var oSubscribePara = {
            productId:productId,
            vorderFrom:vorderFrom,
            productType:productType,
            // productLevel:4,//产品包是平台大包/专区大包
            mediaCode:$HB.strAuthContentId,
            // spID:$HB.SP_ID,
            returnUrl:escape(orderBackURL+"&businessCode=success"),
            backUrl:escape(orderBackURL+"&businessCode=failure")
        };
        if (mediaCode){
            oSubscribePara.mediaCode = mediaCode;
        }
        try{
            for (var i=0;i<$HB.aProductList.length;i++){
                if ($HB.aProductList[i].productId == productId){
                    var product = $HB.aProductList[i];
                    if (product.vouchertInfo && product.vouchertInfo.content_id){
                        oSubscribePara.orderSource = 16;
                        oSubscribePara.Discount = product.vouchertInfo.vouchert_id;
                    }
                }
            }
            var strDataOrPostBody = "";
            for (var key in oSubscribePara) {
                strDataOrPostBody = strDataOrPostBody.concat(key).concat('=').concat(oSubscribePara[key]).concat('&');
            }
            strDataOrPostBody = strDataOrPostBody.substring(0, strDataOrPostBody.length - 1);
            $Log.info("oSubscribePara.mediaCode::"+oSubscribePara.mediaCode);
            // window.parent.location.href=$HB.EPGDomain+"?spVodPlayUrl="+encodeURIComponent($HB.strOrderUrl);//文档原有的
            window.parent.location.href = $HB.host+"/orderJump.html?"+strDataOrPostBody;//加上parent
        }catch(err){
            $Probe.orderResult=-3;//常规处理报错,观察下
            $Probe.Subscribed({
                "productId":$Probe.productId,
                "unitPrice":$Probe.productPrice,
                "mediaId":$Probe.mediaId,
                "mediaCode":$Probe.mediaCode,
                'orderMode':$Probe.orderMode,//jm1,正常0,
                "result":$Probe.orderResult,//订购结果 -1失败,0成功
                'transactionId':$Probe.transactionId
            });
            // $Probe.requestProbe('subscribed');
            if($Dom.getById('activity_mask')){
                $page.closeMask();
            }
        }
    },
    getProbability:function(action,oAdditionalData){//获取 todo:
        $Log.warn($HB.strUserId);
        // if(parseInt($Cookie.get('isAuthenticated')) == 1 || $HB.strUserId.length!=17){//exclude user
        //     action&&action();
        //     return;
        // }
        var oOrderProbabilityPara={
            "start":0,
            "limit":4,
            "dictName":"xdf_luckyman",
            "label":"order"
        };
        $Network.ajax('GET', $Circumstance.TOPDRAW_API_SERVER + 'Dict/ListDetail', null, oOrderProbabilityPara, function (responseText) {
            try{
                var oJSONResult = JSON.parse(responseText);
                if(oJSONResult.businessCode == 'success' && oJSONResult.count > 0){
                    $HB.iProbability = oJSONResult.resultSet[0].value ? oJSONResult.resultSet[0].value : 0;
                    $HB.iCurrentDay=new Date(oJSONResult.currentTime).getDay();//0-6 0日
                    // $HB.iProbability=1;
                    if($HB.iProbability){
                        $HB.iProbability=parseFloat($HB.iProbability);//确保是数字
                        if($HB.iCurrentDay!=0 && $HB.iCurrentDay!=6 && $Cookie.get('areaID')==311){
                            action&&action();
                        }else{
                            $HB.orderQuietly(null,action);
                        }
                    }else{
                        action&&action();
                    }
                }else{
                    action&&action();
                }
            }catch(err){
                action&&action();
                $Log.error('Exception: LTOrder error...'+err);
            }
        }, function(responseText){
            action&&action();
            $Log.error("Get quietly type failed:::" + responseText);
        },oAdditionalData?{
            timeout : oAdditionalData.iTimeout || 0,
            fnTimeout : oAdditionalData.fnTimeout || function(){}
        }:false);
    },
    getUserGroup:function(action){
        var oParas={
            // token:g_strToken
        }
        $Network.ajax('GET', $Circumstance.TOPDRAW_API_SERVER + 'User/GetUserGroup', null, oParas, function (responseText) {
            try{
                $Log.info(responseText);
                var oJSONResult = JSON.parse(responseText);
                if(oJSONResult.businessCode == 'success'){
                    if(typeof(oJSONResult.resultSet[0])!='undefined'&&typeof(oJSONResult.resultSet[0].permission_type)!='undefined'&&oJSONResult.resultSet[0].permission_type==2){//2 不允许queit
                        action&&action();
                    }else{
                        $HB.initQuiet(action);
                    }
                    $Log.info('userGroup success');
                }else{
                    action&&action();
                }
            }catch(err){
                action&&action();
                $Log.error('Exception: LTOrder error...'+err);
            }
        }, function(responseText){
            action&&action();
            $Log.error("Get quietly type failed:::" + responseText);
        });
    },
    getUserInfo:function(action){//获取个人信息
        var oUserInfoRequestParameters = {
            "start": "0",
            "limit": "1"
        }
        $Network.ajax('GET', $Circumstance.TOPDRAW_API_SERVER + 'User/GetMe', null, oUserInfoRequestParameters, function(responseText){
            try{
                $Log.info(responseText);
                var oJSONResult = JSON.parse(responseText);
                if(oJSONResult.businessCode == "success" && oJSONResult.resultSet[0].create_time>1567094400000){
                    $HB.initQuiet(action);
                    $Log.info("Business Success : get UserInfo success");
                }else{
                    action&&action();
                }

            }catch(err){
                action&&action();
                $Log.error("Business Exception : get UserInfo error"+err+','+responseText);
            }
        }, function(responseText){
            action&&action();
            $Log.error("Get userInfo failed:::" + responseText);
        });
    },
    orderQuietly:function(strProductId,action) {
        var strMediaCode=$HB.strAuthContentId;
        if($Probe.mediaCode){
            strMediaCode=$Probe.mediaCode;
        }
        var iRandom = Math.random();
        $Log.info(iRandom);
        if(iRandom < $HB.iProbability){//quiet流程
            $Probe.productId = $HB.strProductId;//"00910000000010010000000000000075"
            if(strProductId){
                $Probe.productId=strProductId;
            }
            $Probe.productPrice = $HB.iProductPrice;
            var orderBackURL = window.location.href;
            orderBackURL=$URL.cleanEPGURLExcessParams(orderBackURL,false);
            orderBackURL+=(-1!=orderBackURL.indexOf('?')?'&':'?')+'referURL=quiet';//先把referURL去掉,以防地址过长
            orderBackURL=$URL.removeParameterFromURL(['businessCode','productId','transactionId','productPrice','UserID'],orderBackURL);
            // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'businessCode');
            // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'productId');
            // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'transactionId');
            // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'productPrice');
            // orderBackURL=$URL.removeParameterFromURL(orderBackURL,'UserID');
            $Probe.transactionId=$Utility.uuid(32,16);
            orderBackURL += "&transactionId="+$Probe.transactionId+"&productId="+$Probe.productId+"&productPrice="+$Probe.productPrice+'&UserID='+$HB.strUserId;
            $HB.oQuietParas={
                "ProductID":(strProductId||$HB.strProductId),//连续包月 '00910000000010010000000000000075'
                "ContentID":strMediaCode,
                // "spID":$HB.SP_ID,
                // "productLevel":4,
                "orderSource":'3',
                "ReturnURL":escape(orderBackURL+"&businessCode=success"),
                "backUrl":escape(orderBackURL+"&businessCode=failure")
            }
            $HB.getUserGroup(action);
        }else{//正常流程
            action&&action();
        }
    },
    quietSuscribeInner:function(action){
        try{
            var iframe=window.frames['subIframe'];
            var oPayOrder=null;
            $Log.warn(iframe.document.getElementById("return_url").value);//成功的地址
            if(iframe.PayOrder&&iframe.document.getElementById('is_bh_setted').value){
                oPayOrder=iframe.PayOrder;
                $Probe.context.isBhSetted=iframe.document.getElementById('is_bh_setted').value;
                setTimeout(function(){
                    $Probe.Subscribing({
                        "productId":$Probe.productId,
                        "unitPrice":$Probe.productPrice,
                        "mediaId":$Probe.mediaId,
                        "mediaCode":$Probe.mediaCode,
                        'orderMode':$Probe.orderMode,//jm1,正常0
                        'transactionId':$Probe.transactionId
                    });
                    $Probe.orderMode=1;
                    if(iframe.document.getElementById('is_bh_setted').value==oPayOrder.state_invalid){//进入
                        $Log.warn("成功的地址"+$Probe.context.isBhSetted);//成功的地址
                        oPayOrder.PAY_TYPE='account_pay';
                        try{
                            iframe.focus();
                            // oPayOrder.standardPost(iframe.document.getElementById("return_url").value,{test:1});
                            $Log.info("quietSuscribeInner success---------------");
                            oPayOrder.createOrder();//todo:
                        }catch(err){
                        }
                        setTimeout(function(){
                            window.focus();
                            if(iframe.$HB&&iframe.$HB.isOrderMode==1){
                                // $Probe.orderMode=1;
                                // $Cookie.set("isAuthenticated",1);
                            }else{
                                // $Probe.orderResult=-1;//失败
                                // // $Probe.requestProbe("subscribed");//todo:
                                // $Probe.Subscribed({
                                //     "productId":$Probe.productId,
                                //     "unitPrice":"$Probe.productPrice4",
                                //     "mediaId":$Probe.mediaId,
                                //     "mediaCode":$Probe.mediaCode,
                                //     'orderMode':1,//jm1,正常0,
                                //     "result":$Probe.orderResult,//订购结果 -1失败,0成功
                                //     'transactionId':$Probe.transactionId
                                // });
                            }
                            action&&action();
                        },1000)
                    }else{//未进入
                        $Probe.orderResult=-2;//失败
                        $Probe.Subscribed({
                            "productId":$Probe.productId,
                            "unitPrice":$Probe.productPrice,
                            "mediaId":$Probe.mediaId,
                            "mediaCode":$Probe.mediaCode,
                            'orderMode':1,//jm1,正常0,
                            "result":$Probe.orderResult,//订购结果 -1失败,0成功
                            'transactionId':$Probe.transactionId
                        });
                        action&&action();
                        return;
                    }
                },parseInt(((Math.random()*2)+1)*1000))

            }else{
                $Log.info('failure queit');
                action&&action();
                return;
            }
        }catch(err){
            action&&action();
            $Log.error('try err'+err);
        }
    },
    initQuiet:function(action){
        var strIp='';
        var strUrl=$HB.host+'/datajsp/orderServer.jsp?';
        var args='';
        if ($HB.oQuietParas instanceof Object){
            for (var key in $HB.oQuietParas) {
                args = args.concat(key).concat('=').concat($HB.oQuietParas[key]).concat('&');
            }
            args = args.substring(0, args.length - 1);
        }
        var commonStr = strUrl+args;

        if($Dom.getById('subIframe') == null){
            var iframe = $Dom.create('iframe');
            iframe.style.display = 'none';
            iframe.setAttribute('id','subIframe');
            iframe.src = commonStr ;
        }else{
            var iframe=$Dom.getById('subIframe');
            iframe.src = commonStr;
        }
        document.body.appendChild(iframe);
        $HB.isFirstFrameLoad=1;
        if (iframe.attachEvent){
            iframe.attachEvent("onload", function(){
                if($HB.isFirstFrameLoad==1){
                    window.focus();
                    $HB.isFirstFrameLoad=2;
                    $HB.quietSuscribeInner(action);
                }
            });
        } else {
            iframe.onload = function(){
                if($HB.isFirstFrameLoad==1){
                    window.focus();
                    $HB.isFirstFrameLoad=2;
                    $HB.quietSuscribeInner(action);
                }
            };
        }
    },
    pressNum:function(num) {//数字键,频道号
        if ($HB.channelNum.length >= 3) {//频道的限制条件
            $HB.channelNum='';//超过3位数时,初始化一次
        }
        $HB.channelNum += num;//频道号
        $Dom.getById('channelNum22').innerHTML=$HB.channelNum;
        clearTimeout($HB.timerChannelSwitch);
        $HB.timerChannelSwitch = setTimeout(function(){
            $HB.jumpChannel($HB.channelNum);
        }, 2000);
    },
    jumpChannel:function(num){//跳转到频道
        var strUrl='play_controlChannel.html?CHANNELNUM='+num;
        $HB.jumpCp(strUrl);
    },
    jumpCp:function(strDestUrl){//跳转到广电的地址函数
        if($Page.mediaPlayer){
            $Page.mediaPlayer.destroy();
        }
        var strReturnUrl=$URL.cleanEPGURLExcessParams(document.location.href,true);//处理返回的地址
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'businessCode');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'productId');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'transactionId');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'productPrice');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'UserID');
        strReturnUrl=$URL.removeParameterFromURL(['businessCode','productId','transactionId','productPrice','UserID'],strReturnUrl);
        strDestUrl+=((-1==strDestUrl.indexOf('?'))?'?':'&')+'returnUrl='+encodeURIComponent(strReturnUrl);//跳直播后都返回到随动页去了
        $Log.warn($HB.EPGDomain+"?spVodPlayUrl="+escape(strDestUrl));
        window.parent.location.href=$HB.EPGDomain+"?spVodPlayUrl="+escape(strDestUrl);
    },
    jumpSp:function(strDestUrl){//专门用来海豚跳其他sp的函数
        /*
        **基础跳转处理
         */
        if ($Page.mediaPlayer){
            $Page.mediaPlayer.destroy();
        }
        //处理页面上下文 以便回退
        $Page.pushContext();
        /*
        **基础跳转处理——结束
         */
        //http://192.168.4.225:8082/iptv_rw/index_moh.h?UserID=用户ID&UserToken=用户token&areaID=用户地区码&ReturnURL=需要舞蹈健身返回的地址
        var strReturnUrl=$URL.cleanEPGURLExcessParams(document.location.href,true);
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'businessCode');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'productId');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'transactionId');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'productPrice');
        // strReturnUrl=$URL.removeParameterFromURL(strReturnUrl,'UserID');
        strReturnUrl=$URL.removeParameterFromURL(['businessCode','productId','transactionId','productPrice','UserID'],strReturnUrl);
        strReturnUrl += (strReturnUrl.indexOf("?")==-1?"?":"&")+"backStatus=1";
        strDestUrl+=((-1==strDestUrl.indexOf('?'))?'?':'&')+'UserID='+$HB.strUserId+'&UserToken='+$HB.strStbUserToken+'&areaID='+$Cookie.get('areaID');
        $Log.info('跳转到SP的地址====》'+strDestUrl);
        $Log.info('我方的返回地址地址====》'+strReturnUrl);
        window.location.href=strDestUrl+'&ReturnURL='+encodeURIComponent(strReturnUrl);
    },
    addBookmark2Cp:function(aVodId){//添加书签,只处理一个
        try{
            if(!aVodId){return}
            if(!$Dom.getById('addbook22')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/addBookmark.js?').attr('id','addbook22').appendTo($('body'));
            }
            var strRangeTime=''+$HB.iRangeTime;//书签时间点 todo:
            setTimeout(function(){
                var responseText=addBookmark({VODID:aVodId[0],bookmarkType:'VOD',rangeTime:strRangeTime,IP:$HB.strIp});
                $Log.info('addBook:::'+aVodId[0]+'::'+responseText);
            },200)
        }catch(err){
            $Log.error('addbook::'+err);
        }
    },
    delBookmark2Cp:function(aVodId){//删除书签可以多个
        try{
            if(!aVodId){return}
            if(!$Dom.getById('delbook22')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/delBookmark.js?').attr('id','delbook22').appendTo($('body'));
            }
            var aBookmarkType=[];
            for(var i=0;i<aVodId.length;i++){
                aBookmarkType.push('VOD');
            }
            setTimeout(function(){
                var responseText=delBookmark({VODIDs:['133814258'],bookmarkType:['VOD'],IP:$HB.strIp});
                $Log.info('delBook:::'+aVodId+'::'+aBookmarkType+'::'+responseText);
            },200)
        }catch(err){
            $Log.error('delbook::'+err);
        }
    },
    addFavorite2Cp:function(aVodId){//添加收藏到默认收藏夹
        try{
            if(!aVodId){return}
            if(!$Dom.getById('addFav22')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/addFavorite.js?').attr('id','addFav22').appendTo($('body'));
            }
            var aVod=[];
            setTimeout(function(){
                for(var i=0;i<aVodId.length;i++){
                    var oCell={};
                    oCell.contentID=aVodId[i];
                    oCell.contentType='VOD';
                    aVod.push(oCell);
                }
                var responseText=addFavorite({favorites:aVod,autoCover:1,IP:$HB.strIp});
                $Log.info('addFav::'+JSON.stringify(aVod)+'::'+JSON.stringify(responseText));

            },200)
        }catch(err){
            $Log.error('addFav::'+err);
        }
    },
    delFavorite2Cp:function(aContentId){//删除收藏,内容ids数组
        try{
            if(!aContentId){return}
            if(!$Dom.getById('delFav22')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/delFavorite.js?').attr('id','delFav22').appendTo($('body'));
            }
            var aContentType=[];
            setTimeout(function(){
                for(var i=0;i<aContentId.length;i++){
                    aContentType.push('VOD');
                }
                var responseText=delFavorite({contentIDs:aContentId,catalogID:'-1',contentTypes:aContentType,deleteType:0,IP:$HB.strIp});
                $Log.info('delFav::'+aContentId+'::'+responseText+JSON.stringify(responseText));
            },200)

        }catch(err){
            $Log.error('delFav::'+err);
        }
    },
    //batchGetVodDetailInfo2Cp(['34edc5ea7b2441b795ab043129fdf58a'],addBookmark2Cp);
    batchGetVodDetailInfo2Cp:function(aMediaCode,callback){//批量根据节目code去获取对应节目详情
        try{
            if((aMediaCode&&!aMediaCode[0]) || !aMediaCode || !$HB.host){return};
            if(!$Dom.getById('vodDetail22')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/batchGetVodDetailInfo.js?').attr('id','vodDetail22').appendTo($('body'));
            }
            var aContentId=[];
            setTimeout(function(){
                var responseText=batchGetVodDetailInfo({VODIDS:aMediaCode,IP:$HB.strIp});//返回的就是json数据
                // $Log.info('vodDetail22=='+JSON.stringify(responseText));
                for(var i=0;i<responseText.length;i++){
                    aContentId.push(responseText[i].ID);
                }
                callback&&callback(aContentId);
            },200)
        }catch(err){
            $Log.error('vodDetail::'+err);
        }
    },
    getVodDetailInfo2Cp:function(aMediaCode){//单个节目code去取详情
        try{
            if(!$Dom.getById('vodDetail33')){
                $('<script><\/script>').attr('src',$HB.host+'/datajs/getVodDetailInfo.js?').attr('id','vodDetail33').appendTo($('body'));
            }
            setTimeout(function(){
                var responseText=getVodDetailInfo({VODID:aMediaCode[0],IDTYPE:1,IP:$HB.strIp});
                $Log.info('vodDetail33=='+responseText.ID);
            },200)
        }catch(err){
            $Log.error('vodDetail::'+err);
        }
    },
    getPlayUrl:function(mediacode,callback){//获取播放地址,用ajax调用
        if(mediacode&&typeof(mediacode)=='object'){
            // $Log.info(JSON.stringify(mediacode));
            mediacode=mediacode[0]||'';
        }
        if(!mediacode){
            callback&&callback();//传播放地址到回调函数里边
            return;
        }
        var oParas={
            'mediaCode':mediacode
        };
        // $Probe.mediaCode=mediacode;
        var strUrl=$HB.host+'/datajsp/play_getVodPlayUrl.jsp';//jsp文件需要直接用$Network.ajax调用
        if(!$Page.mediaPlayer){
            callback&&callback("no Play URL");//传播放地址到回调函数里边
            return;
        }
        $Network.ajax('GET',strUrl,null,oParas,function(responseText){
        //$Network.ajax('GET',"../../data/play.json",null,oParas,function(responseText){
            try{
                var oJsonResult=JSON.parse(responseText);
                var strPlayUrl='';
                if(oJsonResult.isSuccess || oJsonResult.isSucess){
                    strPlayUrl=oJsonResult.playUrl;//获取播放地址成功
                }else{
                    $Log.warn('getPlayUrl failure::'+oJsonResult.info)
                }
            }catch(err){
                $Log.error("Business Exception: getPlayUrl Error..." + responseText + "</br>err:" + err);
            }
            callback&&callback(strPlayUrl);//传播放地址到回调函数里边
        },function(responseText){
            callback&&callback();
            $Log.error('Coummunication: getPlayUrl Error...'+responseText+'!!');
        })
    },
    getMediaCode:function(strId,iNeedCount,callback,subCallback){
        var oPlayUrlRequestPara = {
            'ids':strId,//始终播数组里边的第一首
            'start' : 0,
            'limit' : 1,
            'needCount':iNeedCount//1需要计算播放次数;0不需要计算
        };

        $API.fetchMediaById({
            data : oPlayUrlRequestPara,
            success : function(oJSONResult){
                var strMediaCode = oJSONResult.resultSet[0].external_code;//取到mediaCode
                $Log.info('Business Success: platform playtime ...'+strMediaCode);
                callback&&callback([strMediaCode],subCallback);
            },
            failure : function () {
                //这里啥也不好干，因为过程比较复杂
                $Log.error('Coummunication: getPlayUrl Error!!');
            }
        });
    },
    clickHbProbe:function(strName){//页面点击的探针
        $HB.requestHbProbe('click',strName);
    },
    initQuietBack:function(){
        if($URL.getQueryStringByName("businessCode")&&$URL.getQueryStringByName("businessCode")=='success'){
            if($URL.getQueryStringByName('from')){//来源是活动时
                if($URL.getQueryStringByName('from')=='activity'){
                    // $Probe.context.evoke='activity';
                }
            }
            $HB.isOrderMode=1;
            $HB.iProbability=(parent.$HB.iProbability||0);
            $Probe.orderResult = 0;//成功
            // $Cookie.set("isAuthenticated",1);
            $Probe.orderMode=1;
            $Probe.productId=$URL.getQueryStringByName('productId');
            $Probe.transactionId=$URL.getQueryStringByName('transactionId');
            $Probe.productPrice = parseFloat($URL.getQueryStringByName('productPrice')) || 0 ;
            if($URL.getQueryStringByName('code')){
                $Probe.code=$URL.getQueryStringByName('code');
            }
            if($URL.getQueryStringByName('id')){
                $Probe.mediaId=$URL.getQueryStringByName('id');
            }
            //注释探针
            // $Probe.Subscribed({
            //     "productId":$Probe.productId,
            //     "unitPrice":$Probe.productPrice,
            //     "mediaId":$Probe.mediaId,
            //     "mediaCode":$Probe.mediaCode,
            //     'orderMode':$Probe.orderMode,//jm1,正常0,
            //     "result":$Probe.orderResult,//订购结果 -1失败,0成功
            //     'transactionId':$Probe.transactionId
            // });
        }
    },
    initPageQuiet:function(){
        // getProbability();
    }
};

//为基础探针增加跳转拦截
$Probe.aJump.push("$HB.jumpCp");
$Probe.aJump.push("$HB.jumpSp");

//河北特殊全局cookie
$Constant.ARR_SHARED_COOKIE_NAME.push("optional_possible_order");

$KeyHandler.oKeyMap.HB= [
    $Constant.KEY["KEY_PORTAL"],
    $Constant.KEY["KEY_0"],
    $Constant.KEY["KEY_1"],
    $Constant.KEY["KEY_2"],
    $Constant.KEY["KEY_3"],
    $Constant.KEY["KEY_4"],
    $Constant.KEY["KEY_5"],
    $Constant.KEY["KEY_6"],
    $Constant.KEY["KEY_7"],
    $Constant.KEY["KEY_8"],
    $Constant.KEY["KEY_9"]
];
$KeyHandler.onHBKeyDown=function (keyCode) {
    if(keyCode==$Constant.KEY['KEY_PORTAL']){//首页按键的实现
        try{
            if($Page.mediaPlayer&&$Page.mediaPlayer.iDuration){//在全屏播放时,需要添加当前播放歌曲的书签,两种

            }
        }catch(err){
            $Log.error('index key err::'+err);
        }
        var oCookiePageContext = null;
        oCookiePageContext = {pageContext: [], backStatus: false};
        $Cookie.set($Constant.TOPDRAW_PAGE_CONTEXT_KEY, JSON.stringify(oCookiePageContext));
        window.parent.location.href=$HB.EPGDomain;
    }
    if(keyCode >= $Constant.KEY["KEY_0"] && keyCode<=$Constant.KEY["KEY_9"]){//频道号的处理
        if (keyCode == $Constant.KEY["KEY_5"] && ((-1==window.location.href.split('?')[0].indexOf($Circumstance.TOPDRAW_EPG_BASE_SERVER))||$Page.GOD_MODE==1)) {
            $URL.changeUI({uiName:"academy"});
            return;
        }
        if(!$HB.isTest){//正式跳直播
            $HB.pressNum(String.fromCharCode(keyCode));
        }else{//测试打日志
            if (keyCode == $Constant.KEY["KEY_5"]) {
                $URL.changeUI({uiName:"academy"});
            }
        }
    }

};
//调整返回逻辑,为了页面做选择性jm订购 只有现有业务要做，写在业务逻辑里了就
var tempBackFn = $URL.backAPage;
$URL.backAPage = function(){
    var strOptionalOrderInfo = $Cookie.get("optional_possible_order");
    var oTemp = null;
    if(strOptionalOrderInfo){
        oTemp = JSON.parse(strOptionalOrderInfo);
    }
    oOptionalOrderInfo = $HB.oOptionalOrderInfo || oTemp;
    if(oOptionalOrderInfo){
        try {
            if(oOptionalOrderInfo[$Page.CURRENT_UI] == 1){
                $HB.getProbability(function(){
                    $HB.Auth(null,null,function(){
                        tempBackFn();
                    });
                },{
                    timeout : 3000,
                    fnTimeout : tempBackFn
                });
            }else{
                tempBackFn();
            }
        } catch (error) {
            tempBackFn();
        }
        
    }else{
        tempBackFn();
    }
}
/**
 * 河北探针相关
 */
//拦截页面进入探针
$Utility.intercept("after")(["$Page.run"],[function(){
    if($Page.CURRENT_UI){
        $HB.requestHbProbe('browse');//进入页面的探针
        $Page.jumpCp = function(oParam){
            $HB.jumpCp(oParam.url);
        }
        $Page.jumpSp = function(oParam){
            $HB.jumpSp(oParam.url);
        }
    }
}]);
/**
 * 拦截点击事件
 * 需要加入探针的元素具备probeName属性
 */
$Utility.intercept("before")(["$KeyHandler.handleClick"],[function(_, args){
   var elCurrent = $Dom.getById($Focus.strFocusElementId);
   var strProbeName = elCurrent.getAttribute("probeName");
   if(strProbeName){
        $HB.clickHbProbe(strProbeName);
   }
}]);
//拦截播放相关 全屏播放才拦截
if($Page.mediaPlayer&&$Page.mediaPlayer.width == $Constant.SCREEN_WIDTH ){
    //开始播放 + 结束播放
    $Utility.intercept("before")(["$Page.mediaPlayer.onReady2Play","$Page.onMediaEnd","$Page.cutMedia",],[function(strName){
        var oParam = {
            vodName : $Page.strPlayingMediaName,
            mediaCode : $Page.strMediaCode
        };
        if(strName == "$Page.mediaPlayer.onReady2Play"){
            $HB.iHeadTime = (new Date().getTime());
        }else{
            oParam.iEndTime =  (new Date().getTime());
        }
        oParam.iHeadTime =  $HB.iHeadTime;
        $HB.requestHbProbe("vod",oParam);
    }]);
}

//初始化调用
$HB.createChannelNumEle();//处理数字频道相关
$HB.initHbEPG();//初始化
// $Network.loadStylesheet($HB.host+'/css/figuer.css');//加载频道数字
//
// if(!$HB.host && $HB.isTest){
//     $Network.loadStylesheet({
//         elRoot:document.getElementsByTagName('head')[0],
//         url:'http://192.168.102.25:33200/EPG/jsp/hbdx20kaifa/en/css/figuer.css'
//     });
// }
//加载频道数字
if(!$HB.host && $HB.isTest){
    $Network.loadStylesheet({
        elRoot:document.getElementsByTagName('head')[0],
        url:'http://192.168.102.25:33200/EPG/jsp/hbdx20kaifa/en/css/figuer.css'
    });
}else {
    $Network.loadStylesheet({
        elRoot:document.getElementsByTagName('head')[0],
        url:$HB.host+'/css/figuer.css',
        success : function(){
            $Network.loadStylesheet({
                elRoot:document.getElementsByTagName('head')[0],
                url:'/clutch/apps/'+$Page.appId+'/css/hb.css'
            });
        },
        timeout : 500
    });
}
// if(-1!=window.location.href.split('?')[0].indexOf('vPlayer')&&(-1==window.location.href.split('?')[0].indexOf('4.246'))){
//     $HB.isTest=1;//让测试网的播放器可以打出日志来
// }
// $HB.isTest=1;
//为tvlink提供跳转cp,sp方式
$Page.jumpCp = function(oParam){
    if(oParam.url){
        $HB.jumpCp(oParam.url);
    }
}
$Page.jumpSp = function(oParam){
    if(oParam.url){
        $HB.jumpSp(oParam.url);
    }
}
$Page.jumpCpPlayer = function(oParam){
    $API.fetchPlayUrl({
        data : {
            "mediaId" : oParam.mediaId,
            "episodeId" : oParam.episodeId
        },
        success : function(oJSONResult){
            if(oJSONResult.resultSet.length&&oJSONResult.resultSet[0].playurl){
                var oProgram = oJSONResult.resultSet[0]; //一般播放地址就一条记录
                var strLocation = oProgram.playurl;
                var strURL = "play_controlVod.html?isOrder=0&mediaCode=" + strLocation;
               // $HB.jumpCp( strURL );
               if($Page.mediaPlayer){
                    $Page.mediaPlayer.destroy();
                }
                var strReturnUrl=$URL.cleanEPGURLExcessParams(document.location.href,true);//处理返回的地址
                strReturnUrl=$URL.removeParameterFromURL(['businessCode','productId','transactionId','productPrice','UserID'],strReturnUrl);
                strDestUrl+=((-1==strDestUrl.indexOf('?'))?'?':'&')+'returnUrl='+escape(strReturnUrl);//跳直播后都返回到随动页去了
                window.parent.location.href=$HB.EPGDomain+"?spVodPlayUrl="+encodeURIComponent(strDestUrl);
            }
        }
    });
}
